﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

/// <summary>
/// 单例，用instance获取
/// </summary>
/// <typeparam name="T"></typeparam>
public class Singleton<T>  where T:class
{
    static T _instance;

    static Singleton()
    {
        _instance = Activator.CreateInstance<T>();
        //_instance = new T();
    }

    protected Singleton()
    {

    }

    public static T instance
    {
        get
        {
            return _instance;
        }
    }


}
